package cz.czu.pef.DataModelling.domainObjects;

import java.util.*;

public class Training extends IdObjectImpl implements IdObject
{
  private static final long serialVersionUID = -9213178965572221353L;

  /*
	 * Entity attributes
	 */
	private Date passTimestamp;
	private Date evidencePassExpiration;
	private TrainingType trainingType;

	/*
	 * Relations
	 */
	private Set<Person> persons;

	public Training()
	{
		super();
	}

	public Training(TrainingType trainingType, Date evidencePassExpiration, Date passTimestamp)
	{
		super();
		this.setTrainingType(trainingType);
		this.setEvidencePassExpiration(evidencePassExpiration);
		this.setPassTimestamp(passTimestamp);
	}

	public TrainingType getTrainingType()
	{
		return trainingType;
	}

	
	public void setTrainingType(TrainingType trainingType)
	{
		this.trainingType = trainingType;
	}

	
	public Date getEvidencePassExpiration()
	{
		return evidencePassExpiration;
	}

	
	public void setEvidencePassExpiration(Date evidencePassExpiration)
	{
		this.evidencePassExpiration = evidencePassExpiration;
	}

	public Date getPassTimestamp()
	{
		return passTimestamp;
	}

	public Set<Person> getPersons()
	{
		return persons;
	}

	public List<Person> getPersonsAsList()
	{
		return new ArrayList<Person>(getPersons());
	}

	public void setPassTimestamp(Date passTimestamp)
	{
		this.passTimestamp = passTimestamp;
	}

	
  public void setPersons(Set<Person> persons)
  {
    this.persons = persons;
  }

  @Override
	public String toString()
	{
		StringBuilder builder = new StringBuilder();
		builder.append("Training [getTrainingType()=");
		builder.append(getTrainingType());
		builder.append(", getEvidencePassExpiration()=");
		builder.append(getEvidencePassExpiration());
		builder.append(", getPassTimestamp()=");
		builder.append(getPassTimestamp());
		builder.append("]");
		return builder.toString();
	}
}
